<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
            <title>登录页面</title>
    </head>
    <body>
        <a href="{{ route('index.login.wxLogin') }}">微信登录</a>

        <div>
            <input type="text" name="order_sn"/>
            <a href="javascript:void(0);" onclick="pay();">立即支付</a>
        </div>
        <div id="form_area">

        </div>
    </body>
</html>

<script type="text/javascript" src="{{ asset('style/jquery-2.0.3.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('js/api_request.js') }}"></script>
<script type="text/javascript" src="{{ asset('plugins/layer/layer.js') }}"></script>
<script type="text/javascript">
    function pay() {
        let order_sn = $('input[name="order_sn"]').val();

        requestData('/api/alipay/order_pay',{"order_sn":order_sn}).then((res)=>{
            $('#form_area').append(res.data);
        }).catch((res)=>{
            layer.msg('支付异常，请稍后再试');
        });
    }

    function wxLogin() {
        requestData('{{ route("index.login.wxLogin") }}').then((res)=>{
            layer.msg(res.data.code);
        }).catch((res)=>{
            layer.msg(res);
        })
    }
</script>
